export type Row = { type: 'row'; value: string };

export type TextDoc = { rows: Row[] };

export type PreParagraph = { type: 'paragraph'; rows: Row[] };
export type PreCode = { type: 'code'; lang?: string; rows: Row[] };
export type PreBlockquote = { type: 'blockquote'; blocks: PreBlock[] };

export type PreBlock =
  | PreBlockquote
  | { type: 'heading'; level: number; row: Row }
  | PreCode
  | PreParagraph
  | { type: 'hr' }
  | { type: 'br'; row: Row }
  | Row;

export type ProcessBlock = (pbs: PreBlock[]) => PreBlock[];

export type BlockProcessor = {
  isBlockBegin: (row: Row) => boolean;
  process: ProcessBlock;
};

type ProcessContainer = ProcessBlock;

export type ContainerProcessor = {
  isContainerBegin: (row: Row) => boolean;
  process: ProcessContainer;
};
